﻿using RpcModel;

namespace RpcCentral.Collect.Model
{
    /// <summary>
    /// 服务负载
    /// </summary>
    public class Transmit : ServerTransmit, IEquatable<Transmit>
    {

        /// <summary>
        /// 服务节点Id
        /// </summary>
        public long SeverId
        {
            get;
            set;
        }
        /// <summary>
        /// 排序字段
        /// </summary>
        public int Sort
        {
            get;
            set;
        }
        public override bool Equals(object obj)
        {
            if (obj is Transmit i)
            {
                return i.Scheme == Scheme && i.SeverId == SeverId;
            }
            return false;
        }

        public bool Equals(Transmit other)
        {
            if (other == null)
            {
                return false;
            }
            return other.Scheme == Scheme && other.SeverId == SeverId;
        }

        public override int GetHashCode()
        {
            return string.Concat(Scheme, "_", SeverId).GetHashCode();
        }
    }
}
